package it.polimi.digitalstate.dto;

import javax.validation.constraints.*;

import org.hibernate.validator.constraints.*;

public class UserDTO implements IDataTransferObject{
	private Integer id;
	@NotEmpty(message="This field is required")
	private String username;
	@Email(message="Type a valid email")
	private String email;
	@Size(min=5, message="Your password should be long at least 5 characters")
	private String password;
	private String groupid;
	//I don't know if it is the best way to work, maybe is better to have "CitizenDTO citizen"
	private CitizenDTO citizen;
	
	public UserDTO(String username, String email, String password, String groupid, CitizenDTO citizen){
		this.username=username;
		this.email=email;
		this.password=password;
		this.groupid=groupid;
		this.citizen=citizen;
	}
	public UserDTO(int id,String username, String email, String password, String groupid, CitizenDTO citizen){
		this.username=username;
		this.email=email;
		this.password=password;
		this.groupid=groupid;
		this.citizen=citizen;
		this.id=new Integer(id);
	}
	public UserDTO() {
		// TODO Auto-generated constructor stub
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getGroupid() {
		return groupid;
	}
	public void setGroupid(String groupid) {
		this.groupid = groupid;
	}
	public CitizenDTO getCitizen() {
		return citizen;
	}
	public void setCitizen(CitizenDTO citizen) {
		this.citizen = citizen;
	}
	public int getID(){
		if(id==null){
			//throw an exception
		}
		return id.intValue();
	}
}
